﻿namespace ControleRepresentanteSync.Application.Wizard
{
    internal abstract class WizardPagePresenterBase<TViewModel> : PresenterBase<TViewModel>
        where TViewModel : IWizardPageViewModel
    {
        protected WizardPagePresenterBase(TViewModel viewModel) 
            : base(viewModel)
        {
            ViewModel.TryApplyRequested += ViewModelTryTryApplyRequested;
        }

        private void ViewModelTryTryApplyRequested(object sender, WizardPageTryApplyEventArgs e)
        {
            e.Result = TryApply();
        }

        protected abstract bool TryApply();
    }
}